use std::path::PathBuf;

use serde::{Deserialize, Serialize};

#[derive(Deserialize, Debug, Serialize)]
pub struct GlobalConfig {
    pub address: AddressConfig,
    pub todo_list: TodoListConfig,
}

#[derive(Deserialize, Debug, Serialize)]
pub struct AddressConfig {
    pub db_file: PathBuf,
}

#[derive(Deserialize, Debug, Serialize)]
pub struct TodoListConfig {
    pub db_file: PathBuf,
}

impl GlobalConfig {
    pub fn new() -> GlobalConfig {
        GlobalConfig {
            address: AddressConfig::new(),
            todo_list: TodoListConfig::new(),
        }
    }
}

impl AddressConfig {
    pub fn new() -> AddressConfig {
        AddressConfig {
            db_file: PathBuf::new(),
        }
    }
}

impl TodoListConfig {
    pub fn new() -> TodoListConfig {
        TodoListConfig {
            db_file: PathBuf::new(),
        }
    }
}
